package xyz.lisys.boot.service;

import lombok.val;
import org.kie.api.KieBase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.lisys.boot.pojo.Person;

@Service
public class RuleService {

    @Autowired
    public KieBase kieBase;

    public Person executeRule(Person person) {
        val kieSession = kieBase.newKieSession();
        kieSession.insert(person);
        kieSession.fireAllRules();
        kieSession.dispose();
        return person;
    }
}
